{include file='Public/header' /}
<div class="layui-layout layui-layout-admin">
{include file='Public/head' /}	
{include file='Public/side' /}	
	<div class="layui-body"> 
{include file='Public/crumbs' /}
		<!-- 内容主体区域 -->
		<div class="shu-body">
			<div class="layui-fluid">
				<form class="layui-form layui-form-pane" action="" method="post">
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
				  	<div class="layui-input-inline">
					<input type="text"
                                    {notempty name='member'}
                                    {if condition="$member['uid'] eq 1"}readonly{/if}
                                    {/notempty}
                                    {empty name='member'}
                                    name="user"
                                    {/empty}
                                    required lay-verify="required" autocomplete="off" class="layui-input" value="{notempty name='member'}{$member.user}{/notempty}" placeholder="用户名">
                                    <input type="hidden" name="uid" value="{notempty name='member'}{$member['uid']}{/notempty}">
				    </div>
					<div class="layui-form-mid layui-word-aux">
					{notempty name='member'}
					{if condition="$member['uid'] eq 1"}无法修改{/if}
					{/notempty}</div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">用户组</label>
				  	<div class="layui-input-inline">
						{notempty name='member'}
						{if condition="$member['uid'] eq 1"}
							{volist name="usergroup" id="val"}
							
								{if condition="$val['id'] eq $member['group_id']"}
									<input type="text" class="layui-input" value="{$val['title']}"
										   readonly>
									<input type="hidden" name="group_id" id="group_id"
										   class="layui-input" value="{$member['group_id']}">
								{/if}
							  
							{/volist}
						{else /}
							<select id="group_id" name="group_id" class="rcol-xs-10 col-sm-5">
								{volist name="usergroup" id="val"}
									<option value="{$val['id']}"
										{notempty name='member'}
									{if condition="$val['id'] eq $member['group_id']"}selected="selected"
									{/if}
									{/notempty}
									>{$val['title']}</option>
								{/volist}
							</select>
					   {/if}
					   {/notempty}	
					   {empty name='member'}
							<select id="group_id" name="group_id" class="rcol-xs-10 col-sm-5">
								{volist name="usergroup" id="val"}
									<option value="{$val['id']}"
										{notempty name='member'}
									{if condition="$val['id'] eq $member['group_id']"}selected="selected"
									{/if}
									{/notempty}
									>{$val['title']}</option>
								{/volist}
							</select>
					   
						{/empty} 
				  	</div>
					<div class="layui-form-mid layui-word-aux">请选择用户组</div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">用户密码</label>
				  	<div class="layui-input-inline">
					<input type="password" name="password" id="password" placeholder="用户密码" class="layui-input" value="" class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux">密码</div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label" style="height:100px; line-height:80px;">头像</label>
				  	<div class="layui-input-inline">
					{:UpImage("head",100,100,$member['head'])}
				  	</div>
					<div class="layui-form-mid layui-word-aux" style="line-height:80px">仅支持jpg、gif、png、bmp、jpeg，且小于1MB。</div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">性别</label>
				  	<div class="layui-input-inline">
					<select id="sex" name="sex" class="multiselect">
                                        <option value="0"
                                        {notempty name='member'}
                                        {if condition="$member['sex'] eq 0"}selected="selected"{/if}
                                        {/notempty}
                                        >保密</option>
                                        <option value="1"
                                        {notempty name='member'}
                                        {if condition="$member['sex'] eq 1"}selected="selected"{/if}
                                        {/notempty}
                                        >男</option>
                                        <option value="2"
                                        {notempty name='member'}
                                        {if condition="$member['sex'] eq 2"}selected="selected"{/if}
                                        {/notempty}
                                        >女</option>
                    </select>
				  	</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">生日</label>
				  	<div class="layui-input-inline">
						<input class="layui-input" id="birthday" name="birthday" value="{notempty name='member'}{if condition="$member['birthday'] neq '' "}{$member['birthday']|date="Y-m-d",###}{/if}{/notempty}" type="text"/>
				 	</div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">电话号码</label>
				  	<div class="layui-input-inline">
					<input type="text" name="phone" id="phone" placeholder="电话号码" class="layui-input" value="{notempty name='member'}{$member['phone']}{/notempty}" class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">QQ</label>
				  	<div class="layui-input-inline">
					<input type="text" name="qq" id="qq" placeholder="QQ" class="layui-input" value="{notempty name='member'}{$member['qq']}{/notempty}" class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">E-mail</label>
				  	<div class="layui-input-inline">
					<input type="text" name="email" id="email" placeholder="E-mail" class="layui-input" value="{notempty name='member'}{$member['email']}{/notempty}" class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
				  <div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				  </div>
				</div>
			  </form>
			</div>
		</div>
		<!-- 内容主体区域 END-->
	</div>
{include file='Public/footer' /}	
<script>
layui.use(['form','layer','laydate'], function(){
	var form = layui.form,jq = layui.jquery,layer=layui.layer,laydate = layui.laydate;
	//日期
	laydate.render({
    	elem: '#birthday' //指定元素
  	});
	
	form.on('submit(formDemo)', function(data){
		loading = layer.load(2, {
			shade: [0.2,'#000']
		});
		var param = data.field;
		jq.post("{:url('update')}",param,function(data){
			//console.log(data);
			if(data.code == 200){
				layer.close(loading);
				layer.msg(data.msg, {icon: 1, time: 1000}, function(){
					//location.reload();
					location.href="{:url('index')}";
				});
			}else{
				layer.close(loading);
				layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
			}
		});
	return false;
	});
});
</script>